package com.k8.common;

import com.k8.common.factroy.loader.ExtensionLoader;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.Map;

public class JdkAdaptiveProxy implements InvocationHandler {
    ExtensionLoader<?> extensionLoader;
    Object target;
    Map<Integer, Integer> candidateAdaptiveParaReflectMap;
    Class<?> targetClass;

    public JdkAdaptiveProxy(ExtensionLoader<?> extensionLoader, Object target, Map<Integer, Integer> candidateAdaptiveParaReflectMap) {
        this.extensionLoader = extensionLoader;
        this.target = target;
        this.targetClass=target.getClass();
        this.candidateAdaptiveParaReflectMap=candidateAdaptiveParaReflectMap;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        Method method1 = targetClass.getMethod(method.getName(), method.getParameterTypes());
        Integer paraIndex = candidateAdaptiveParaReflectMap.get(method1.getModifiers());
        return null;
    }
}
